package com.buka.user.service;

import com.buka.user.dao.UserDao;
import com.buka.user.entity.User;

import java.util.List;

public class UserService {

    UserDao userDao = new UserDao();

    //保存数据
    public int save(User user) {
        return userDao.save(user);
    }

    public List<User> selectList() {
        return userDao.selectList();
    }

    public User selectByNameAndPasswd(String userName, String passwd) {
        if (userName != null && passwd != null) {
            return userDao.selectByNameAndPasswd(userName, passwd);
        }else{
            return null;
        }
    }

    public int update(User user) {
        return userDao.update(user);
    }

    public User selectById(String id) {
        return userDao.selectById(id);
    }

    public int deleteById(String id){
        return userDao.deleteById(id);
    }
}
